<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<%--<t:base type="jquery,easyui,tools"/>--%>
<div class="easyui-layout" fit="true" id="main_qDimList">
    <div region="center" style="padding:1px;">
        <t:datagrid name="qDimList" title="" actionUrl="cqDimController.do?datagrid&qid=${qid}" idField="id" fit="true"
                    queryMode="group">
            <t:dgCol title="主键" field='id' hidden="true"></t:dgCol>
            <t:dgCol title="纬度名称" field='name' query="true" width="2"></t:dgCol>
            <%--<t:dgCol title="纬度说明" field="dimDesc" width="6"></t:dgCol>--%>
            <%--<t:dgCol title="所属量表" field="questEntity.name" width="1" query="true"></t:dgCol>--%>
            <%--<t:dgCol title="归属平台" field="questEntity.platformEntity.name"  query="true"></t:dgCol>--%>
            <%--<t:dgCol title="创建时间" field="createTime" width="1" query="true"></t:dgCol>--%>

            <t:dgCol title="common.operation" field="opt" width="2"></t:dgCol>
            <t:dgDelOpt url="cqDimController.do?del&id={id}" title="删除"></t:dgDelOpt>
            <t:dgFunOpt funname='showDimResult(id,name)' title='结果分析'></t:dgFunOpt>

            <t:dgToolBar title="新增" icon="icon-add" url="cqDimController.do?addorupdate&qid=${qid}" funname="add" width="800"
                         height="600"></t:dgToolBar>
            <t:dgToolBar title="修改" icon="icon-edit" url="cqDimController.do?addorupdate" funname="f_updateInfo"
                         width="800" height="600"></t:dgToolBar>
            <t:dgToolBar title="预览" icon="icon-search" url="cqDimController.do?detail" funname="f_detail" width="800"
                         height="600"></t:dgToolBar>

        </t:datagrid>
    </div>
</div>
<%--<div region="east" split="true" style="width: 60%;">--%>
<%--<div tools="#tt" class="easyui-panel" title='量表问题' style="padding: 10px;"--%>
<%--fit="true" border="false" id="function-panel"></div>--%>
<%--</div>--%>
<%--<div id="tt"></div>--%>
<%--</div>--%>
<div data-options="region:'east',
	title:'mytitle',
	collapsed:true,
	split:true,
	border:false,
	onExpand : function(){
		li_east = 1;
	},
	onCollapse : function() {
	    li_east = 0;
	}"
     style="width: 600px; overflow: hidden;" id="eastPanel">
    <div class="easyui-panel" style="padding: 1px;" fit="true" border="false" id="showPanel2"></div>
</div>
<script type="text/javascript">
    $(function () {
        var li_east = 0
    });
    //    function showDimResult(id, name) {
    //        $("#function-panel").panel(
    //                {
    //                    title: name,
    //                    href: "csResultController.do?index&dimId=" + id
    //                }
    //        );
    //        $('#function-panel').panel("refresh");
    //
    //    }
    function f_updateInfo(title, url, id, width, height) {
        gridname = id;
        var rowsData = $('#' + id).datagrid('getSelections');
        if (!rowsData || rowsData.length == 0) {
            tip('请选择编辑纬度');
            return;
        }
        if (rowsData.length > 1) {
            parent.tip('请选择一条量表再编辑');
            return;
        }

        url += '&id=' + rowsData[0].id;
        createwindow(title, url, width, height);
    }

    function f_detail(title, url, id, width, height) {
        gridname = id;
        var rowsData = $('#' + id).datagrid('getSelections');
        if (!rowsData || rowsData.length == 0) {
            tip('请选择纬度');
            return;
        }
        if (rowsData.length > 1) {
            tip('请选择一条纬度再查看');
            return;
        }

        url += '&id=' + rowsData[0].id;
        createdetailwindow(title, url, width, height);
    }

    function showDimResult(id, name) {

        var title = "分析【" + name + "】";
        if (li_east == 0) {
            $('#main_qDimList').layout('expand', 'east');
        }
        $('#main_qDimList').layout('panel', 'east').panel('setTitle', title);
        $('#main_qDimList').layout('panel', 'east').panel('resize', {width: 400});
        $('#showPanel2').panel('refresh', 'csResultController.do?index&dimId=' + id);
    }


</script>
